#include <stdio.h>
#include <time.h>

int main() {
  time_t current = time(NULL);
  struct tm *ptr;
  char date_time[21];
  int hour;
  char am_or_pm;

  puts(ctime(&current));

  strftime(date_time, sizeof(date_time), "%m-%d-%Y %I:%M%p\n",
           localtime(&current));

  puts(date_time);

  ptr = localtime(&current);
  hour = ptr->tm_hour;
  if (hour <= 11)
    am_or_pm = 'a';
  else {
    hour -= 12;
    am_or_pm = 'p';
  }
  if (hour == 0)
    hour = 12;

  printf("%.2d-%.2d-%.2d %2d:%.2d%c\n", ptr->tm_mon + 1, ptr->tm_mday,
         ptr->tm_year + 1900, hour, ptr->tm_min, am_or_pm);

  return 0;
}